<?php 

namespace app\user\controller;

use think\Db;
use app\user\model\AdminUserModel;

class AdminUserCore {
	/**
	 * 验证账号密码 - Core
	 */
	public static function verifyAdminUserCore($username, $password) {
		$whereCondt = [
			AdminUserModel::USERNAME => $username,
			AdminUserModel::PASSWORD => user_md5($password)
		];
		$res = self::selectAdminUserCore($whereCondt);
		if (!empty($res->data->list)) {
			return operationRes(true, lang('verify_successful'), $res->data->list[0]);
		}
		return operationRes(false, lang('verify_failed'));
	}

	/**
	 * 查询 - Core
	 */
	public static function selectAdminUserCore($whereCondt) {
		$list = AdminUserModel::where($whereCondt)->select();
		$returnData = [
			'list' => $list
		];
		return operationRes(true, lang('query_successful'), $returnData);
	}
}